import $ from '../utils';

module.exports.connectDB = async function () {
    //连接数据库
    return new Promise((resolve,reject)=>{
        $.config.MongoClient.connect($.config.MONGODB_CONN_STR, function(err, db) {
            //console.log(err,db)
            if(!err){
                resolve(db)
                //console.log('connectDB',db)
            }else{
                //resolve(false)
                console.log('connectDB',err)
            }
        });
    })
}